VERSION 5.00
Begin VB.Form Edit 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Edit Setting"
   ClientHeight    =   3090
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4680
   ControlBox      =   0   'False
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   240
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   1320
      Visible         =   0   'False
      Width           =   4095
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3480
      TabIndex        =   6
      Top             =   2520
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "OK"
      Height          =   375
      Left            =   2400
      TabIndex        =   5
      Top             =   2520
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Default"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   2520
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   240
      TabIndex        =   3
      Text            =   "Combo1"
      Top             =   1320
      Width           =   4095
   End
   Begin VB.Label Label4 
      Caption         =   "Label4"
      Height          =   1215
      Left            =   240
      TabIndex        =   8
      Top             =   1680
      Visible         =   0   'False
      Width           =   4095
   End
   Begin VB.Label Label3 
      Caption         =   "Current Value:"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   960
      Width           =   2295
   End
   Begin VB.Label Label2 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Label2"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   4095
   End
   Begin VB.Label Label1 
      Caption         =   "Name:"
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   2175
   End
End
Attribute VB_Name = "Edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim id As String
Dim idname As String
Dim hid As Integer

Private Sub Command2_Click()
If (checkinput(Text1.Text)) Then
    If (hid = 11) Then
        MCM.H11 = Hex$(Combo1.ListIndex + 48)
        MCM.ListView1.ListItems.Item("beep").ListSubItems(1) = MCM.conv("H11")
    ElseIf (hid = 12) Then
        MCM.H12 = Hex$(Combo1.ListIndex + 48)
        MCM.ListView1.ListItems.Item("delay").ListSubItems(1) = MCM.conv("H12")
    ElseIf (hid = 13) Then
        MCM.H13 = Hex$(Combo1.ListIndex + 48)
        MCM.ListView1.ListItems.Item("trackselection").ListSubItems(1) = MCM.conv("H13")
    ElseIf (hid = 14) Then
        MCM.H14 = Hex$(Text1.Text)
        If (Len(MCM.H14) = 1) Then
            MCM.H14 = "0" & MCM.H14
        End If
        MCM.ListView1.ListItems.Item("pollingintervalid").ListSubItems(1) = MCM.conv("H14")
    ElseIf (hid = 17) Then
        MCM.H17 = MCM.text2cmd(Text1.Text, 1)
        MCM.ListView1.ListItems.Item("separator").ListSubItems(1) = MCM.conv("H17")
    ElseIf (hid = 190) Then
        MCM.H19 = 30 + Combo1.ListIndex * 8 + ("&H" & MCM.H19) Mod 2
        MCM.ListView1.ListItems.Item("sendoptionid").ListSubItems(1) = MCM.conv("H190")
    ElseIf (hid = 191) Then
        MCM.H19 = Hex$(("&H" & MCM.H19) + (Combo1.ListIndex + 1) Mod 2 - ("&H" & MCM.H19) Mod 2)
        MCM.ListView1.ListItems.Item("sendsentinel").ListSubItems(1) = MCM.conv("H191")
    ElseIf (hid = 192) Then
        MCM.H19 = Hex$(("&H" & MCM.H19) - CInt(CByte(("&H" & MCM.H19) - 40) And CByte(2)) + ((Combo1.ListIndex + 1) Mod 2) * 2)
        MCM.ListView1.ListItems.Item("track2account").ListSubItems(1) = MCM.conv("H192")
    ElseIf (hid = 21) Then
        MCM.H21 = MCM.text2cmd(Text1.Text, 1)
        MCM.ListView1.ListItems.Item("terminator").ListSubItems(1) = MCM.conv("H21")
    ElseIf (hid = 23) Then
        MCM.H23 = Hex$(Combo1.ListIndex * 8 + 48)
        MCM.ListView1.ListItems.Item("usbmode").ListSubItems(1) = MCM.conv("H23")
    ElseIf (hid = 24) Then
        MCM.H24 = Hex$(Combo1.ListIndex + 48)
        MCM.ListView1.ListItems.Item("language").ListSubItems(1) = MCM.conv("H24")
    ElseIf (hid = 61) Then
        MCM.H61 = Mid$(MCM.text2cmd(Text1.Text, 3), 1, 2)
        MCM.H64 = Mid$(MCM.text2cmd(Text1.Text, 3), 4, 2)
        MCM.H66 = Mid$(MCM.text2cmd(Text1.Text, 3), 7, 2)
        MCM.ListView1.ListItems.Item("7bitsentinel").ListSubItems(1) = MCM.conv("H61") & MCM.conv("H64") & MCM.conv("H66")
    ElseIf (hid = 62) Then
        MCM.H62 = Mid$(MCM.text2cmd(Text1.Text, 2), 1, 2)
        MCM.H67 = Mid$(MCM.text2cmd(Text1.Text, 2), 4, 2)
        MCM.ListView1.ListItems.Item("6bitsentinel").ListSubItems(1) = MCM.conv("H62") & MCM.conv("H67")
    ElseIf (hid = 63) Then
        MCM.H63 = Mid$(MCM.text2cmd(Text1.Text, 3), 1, 2)
        MCM.H65 = Mid$(MCM.text2cmd(Text1.Text, 3), 4, 2)
        MCM.H68 = Mid$(MCM.text2cmd(Text1.Text, 3), 7, 2)
        MCM.ListView1.ListItems.Item("5bitsentinel").ListSubItems(1) = MCM.conv("H63") & MCM.conv("H65") & MCM.conv("H68")
    ElseIf (hid = 69) Then
        MCM.H69 = Mid$(MCM.text2cmd(Text1.Text, 3), 1, 2)
        MCM.H6A = Mid$(MCM.text2cmd(Text1.Text, 3), 4, 2)
        MCM.H6B = Mid$(MCM.text2cmd(Text1.Text, 3), 7, 2)
        MCM.ListView1.ListItems.Item("endsentinel").ListSubItems(1) = MCM.conv("H69") & MCM.conv("H6A") & MCM.conv("H6B")
    ElseIf (hid = 34) Then
        MCM.H34 = MCM.text2cmd(Text1.Text, 6)
        MCM.ListView1.ListItems.Item("t1prefix").ListSubItems(1) = MCM.conv("H34")
    ElseIf (hid = 37) Then
        MCM.H37 = MCM.text2cmd(Text1.Text, 6)
        MCM.ListView1.ListItems.Item("t1suffix").ListSubItems(1) = MCM.conv("H37")
    ElseIf (hid = 35) Then
        MCM.H35 = MCM.text2cmd(Text1.Text, 6)
        MCM.ListView1.ListItems.Item("t2prefix").ListSubItems(1) = MCM.conv("H35")
    ElseIf (hid = 38) Then
        MCM.H38 = MCM.text2cmd(Text1.Text, 6)
        MCM.ListView1.ListItems.Item("t2suffix").ListSubItems(1) = MCM.conv("H38")
    ElseIf (hid = 36) Then
        MCM.H36 = MCM.text2cmd(Text1.Text, 6)
        MCM.ListView1.ListItems.Item("t3prefix").ListSubItems(1) = MCM.conv("H36")
    ElseIf (hid = 39) Then
        MCM.H39 = MCM.text2cmd(Text1.Text, 6)
        MCM.ListView1.ListItems.Item("t3suffix").ListSubItems(1) = MCM.conv("H39")
    ElseIf (hid = 132) Then 'D2
        MCM.HD2 = MCM.text2cmd(Text1.Text, 15)
        MCM.ListView1.ListItems.Item("preamble").ListSubItems(1) = MCM.conv("HD2")
    ElseIf (hid = 133) Then 'D3
        MCM.HD3 = MCM.text2cmd(Text1.Text, 15)
        MCM.ListView1.ListItems.Item("postamble").ListSubItems(1) = MCM.conv("HD3")
    End If
    
    MCM.id = "0"
    Me.Hide
Else
    MsgBox ("Invalid Input")
End If
End Sub

Private Sub Command3_Click()
    MCM.id = "0"
    Me.Hide
End Sub

Private Sub Form_Activate()
    id = MCM.id
    idname = MCM.idname
    Label2.Caption = idname '& "|" & id
    Combo1.Clear
    Text1.Text = ""
    Label4.Caption = "<dd>  Character in hexadecimal notation" & vbCrLf & "<0a>  Line feed" & vbCrLf & "<0d>  Carriage return" & vbCrLf & "<08>  Backspace" & vbCrLf & "<7f>   Delete"
    Combo1.Visible = True
    Text1.Visible = True
    Label4.Visible = False

    If (id = "beep") Then
        hid = 11
        Text1.Visible = False
        Combo1.AddItem ("OFF")
        Combo1.AddItem ("LOW")
        Combo1.AddItem ("HIGH")
        Combo1.AddItem ("Quick HIGH")
        Combo1.AddItem ("Quick LOW")
        Combo1.ListIndex = (("&H" & MCM.H11) - 48)
    ElseIf (id = "delay") Then
        hid = 12
        Text1.Visible = False
        Combo1.AddItem ("2 ms")
        Combo1.AddItem ("5 ms")
        Combo1.AddItem ("10 ms")
        Combo1.AddItem ("20 ms")
        Combo1.AddItem ("50 ms")
        Combo1.AddItem ("100 ms")
        Combo1.ListIndex = (("&H" & MCM.H12) - 48)
    ElseIf (id = "trackselection") Then
        hid = 13
        Text1.Visible = False
        Combo1.AddItem ("Any Track")
        Combo1.AddItem ("Track 1")
        Combo1.AddItem ("Track 2")
        Combo1.AddItem ("Track 1 And 2")
        Combo1.AddItem ("Track 3")
        Combo1.AddItem ("Track 1 And 3")
        Combo1.AddItem ("Track 2 ANd 3")
        Combo1.AddItem ("All Tracks")
        Combo1.AddItem ("Track 1 Or 2")
        Combo1.AddItem ("Track 2 Or 3")
        Combo1.ListIndex = (("&H" & MCM.H13) - 48)
    ElseIf (id = "pollingintervalid") Then
        Label4.Visible = True
        hid = 14
        Combo1.Visible = False
        Text1.Text = CInt("&H" & MCM.H14)
    ElseIf (id = "separator") Then
        Label4.Visible = True
        hid = 17
        Combo1.Visible = False
        Text1.Text = MCM.conv("H17")
    ElseIf (id = "sendoptionid") Then
        hid = 190
        Text1.Visible = False
        Combo1.AddItem ("Ctrl Key Output")
        Combo1.AddItem ("Alt Key Output")
        If ((("&H" & MCM.H19) - 48) < 8) Then
            Combo1.ListIndex = 0
        Else
            Combo1.ListIndex = 1
        End If
    ElseIf (id = "sendsentinel") Then
        hid = 191
        Text1.Visible = False
        Combo1.AddItem ("Yes")
        Combo1.AddItem ("No")
        'MsgBox ((("&H" & MCM.H19) - 48) & "|" & (("&H" & MCM.H19) - 48) \ 2 & "|" & (("&H" & MCM.H19) - 48) Mod 1)
        Combo1.ListIndex = (("&H" & MCM.H19) - 48 + 1) Mod 2
    ElseIf (id = "track2account") Then
        hid = 192
        Text1.Visible = False
        Combo1.AddItem ("Yes")
        Combo1.AddItem ("No")
        'MsgBox Hex$("&H" & MCM.H19)
        If ((("&H" & MCM.H19) - 48) Mod 4 > 1) Then
            Combo1.ListIndex = 0
        Else
            Combo1.ListIndex = 1
        End If
    ElseIf (id = "terminator") Then
        Label4.Visible = True
        hid = 21
        Combo1.Visible = False
        Label4.Visible = True
        Text1.Text = MCM.conv("H21")
    ElseIf (id = "usbmode") Then
        hid = 23
        Text1.Visible = False
        Combo1.AddItem ("USB HID")
        Combo1.AddItem ("USB KB")
        Combo1.ListIndex = (("&H" & MCM.H23) - 48) / 8
    ElseIf (id = "language") Then
        hid = 24
        Text1.Visible = False
        Combo1.AddItem ("US")
        Combo1.AddItem ("Swiss")
        Combo1.AddItem ("Swedish")
        Combo1.AddItem ("Spanish")
        Combo1.AddItem ("Norwegian")
        Combo1.AddItem ("Italian")
        Combo1.AddItem ("German")
        Combo1.AddItem ("French")
        Combo1.AddItem ("Japanese")
        Combo1.AddItem ("UK")
        Combo1.AddItem ("Universal")
        Combo1.ListIndex = (("&H" & MCM.H24) - 48)
    ElseIf (id = "7bitsentinel") Then
        Label4.Visible = True
        hid = 61
        Combo1.Visible = False
        Text1.Text = MCM.conv("H61") & MCM.conv("H64") & MCM.conv("H66") & "          <<==(7Bit)(6Bit)(5Bit)"
    ElseIf (id = "6bitsentinel") Then
        Label4.Visible = True
        hid = 62
        Combo1.Visible = False
        Text1.Text = MCM.conv("H62") & MCM.conv("H67") & "          <<==(7Bit)(    )(5Bit)"
    ElseIf (id = "5bitsentinel") Then
        Label4.Visible = True
        hid = 63
        Combo1.Visible = False
        Text1.Text = MCM.conv("H63") & MCM.conv("H65") & MCM.conv("H68") & "          <<==(7Bit)(6Bit)(5Bit)"
    ElseIf (id = "endsentinel") Then
        Label4.Visible = True
        hid = 69
        Combo1.Visible = False
        Text1.Text = MCM.conv("H69") & MCM.conv("H6A") & MCM.conv("H6B") & "          <<==(7Bit)(6Bit)(5Bit)"
    ElseIf (id = "t1prefix") Then
        Label4.Visible = True
        hid = 34
        Combo1.Visible = False
        Text1.Text = MCM.conv("H34")
    ElseIf (id = "t1suffix") Then
        Label4.Visible = True
        hid = 37
        Combo1.Visible = False
        Text1.Text = MCM.conv("H37")
    ElseIf (id = "t2prefix") Then
        Label4.Visible = True
        hid = 35
        Combo1.Visible = False
        Text1.Text = MCM.conv("H35")
    ElseIf (id = "t2suffix") Then
        Label4.Visible = True
        hid = 38
        Combo1.Visible = False
        Text1.Text = MCM.conv("H38")
    ElseIf (id = "t3prefix") Then
        Label4.Visible = True
        hid = 36
        Combo1.Visible = False
        Text1.Text = MCM.conv("H36")
    ElseIf (id = "t3suffix") Then
        Label4.Visible = True
        hid = 39
        Combo1.Visible = False
        Text1.Text = MCM.conv("H39")
    ElseIf (id = "preamble") Then
        Label4.Visible = True
        hid = 132 'D2
        Combo1.Visible = False
        Text1.Text = MCM.conv("HD2")
    ElseIf (id = "postamble") Then
        Label4.Visible = True
        hid = 133 'D3
        Combo1.Visible = False
        Text1.Text = MCM.conv("HD3")
    End If
End Sub

Public Function checkinput(ByRef X As String) As Boolean
    Dim z As Integer
    Dim a As Integer
    Dim b As Integer
    If (Len(X) = 0) Then
        checkinput = True
    Else
        checkinput = True
        z = 1
        Do While z <= Len(X)
            If (Mid$(X, z, 1) = "<" And Mid$(X, z + 3, 1) = ">") Then
                If (Mid$(X, z + 1, 1) = "0" Or Mid$(X, z + 1, 1) = "1" Or _
                    Mid$(X, z + 1, 1) = "2" Or Mid$(X, z + 1, 1) = "3" Or _
                    Mid$(X, z + 1, 1) = "4" Or Mid$(X, z + 1, 1) = "5" Or _
                    Mid$(X, z + 1, 1) = "6" Or Mid$(X, z + 1, 1) = "7" Or _
                    Mid$(X, z + 1, 1) = "8" Or Mid$(X, z + 1, 1) = "9" Or _
                    Mid$(X, z + 1, 1) = "A" Or Mid$(X, z + 1, 1) = "a" Or _
                    Mid$(X, z + 1, 1) = "B" Or Mid$(X, z + 1, 1) = "b" Or _
                    Mid$(X, z + 1, 1) = "C" Or Mid$(X, z + 1, 1) = "c" Or _
                    Mid$(X, z + 1, 1) = "D" Or Mid$(X, z + 1, 1) = "d" Or _
                    Mid$(X, z + 1, 1) = "E" Or Mid$(X, z + 1, 1) = "e" Or _
                    Mid$(X, z + 1, 1) = "F" Or Mid$(X, z + 1, 1) = "f") Then
                    If (Mid$(X, z + 2, 1) = "0" Or Mid$(X, z + 2, 1) = "1" Or _
                        Mid$(X, z + 2, 1) = "2" Or Mid$(X, z + 2, 1) = "3" Or _
                        Mid$(X, z + 2, 1) = "4" Or Mid$(X, z + 2, 1) = "5" Or _
                        Mid$(X, z + 2, 1) = "6" Or Mid$(X, z + 2, 1) = "7" Or _
                        Mid$(X, z + 2, 1) = "8" Or Mid$(X, z + 2, 1) = "9" Or _
                        Mid$(X, z + 2, 1) = "A" Or Mid$(X, z + 2, 1) = "a" Or _
                        Mid$(X, z + 2, 1) = "B" Or Mid$(X, z + 2, 1) = "b" Or _
                        Mid$(X, z + 2, 1) = "C" Or Mid$(X, z + 2, 1) = "c" Or _
                        Mid$(X, z + 2, 1) = "D" Or Mid$(X, z + 2, 1) = "d" Or _
                        Mid$(X, z + 2, 1) = "E" Or Mid$(X, z + 2, 1) = "e" Or _
                        Mid$(X, z + 2, 1) = "F" Or Mid$(X, z + 2, 1) = "f") Then
                        checkinput = True
                    Else
                        checkinput = False
                        z = Len(X) + 1
                    End If
                Else
                    checkinput = False
                    z = Len(X) + 1
                End If
                z = z + 4
            Else
                z = z + 1
            End If
            
        Loop
    End If
End Function

Private Sub Form_KeyPress(KeyAscii As Integer)
        On Error Resume Next
    Select Case KeyAscii
        Case vbKeyReturn 'Then Find which key you want to use from the list below
            'Code to run when key is pressed
            Call Command2_Click
    End Select

End Sub

Private Sub Form_Terminate()
    MCM.id = "0"
    Me.Hide
End Sub
